package com.guigu.tms.base.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.tms.commons.entity.base.BaseTruckType;
import com.guigu.tms.base.service.IPdTruckTypeService;
import com.guigu.tms.commons.entity.base.PdGoodsType;
import com.guigu.tms.commons.entity.base.PdTruckType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 车辆类型表 前端控制器
 * </p>
 *
 * @author wj
 * @since 2022-09-26
 */
@RestController
@RequestMapping("/pdTruckType")
public class PdTruckTypeController {

    @Autowired
    IPdTruckTypeService iPdTruckTypeService;

    @GetMapping("/ShowPdTruckType")
    public List<PdTruckType> ShowPdTruckType(){
        return iPdTruckTypeService.ShowPdTruckType();
    }

    @PostMapping("/BaseTruckTypeList")
    public PageInfo<BaseTruckType> BaseTruckTypeList(@RequestBody Map<String, String> map){
        return iPdTruckTypeService.BaseTruckTypeList(map);
    }

    @GetMapping("/ShowPdGoodsType")
    public List<PdGoodsType> ShowPdGoodsType(){
        return iPdTruckTypeService.ShowPdGoodsType();
    }

    @PostMapping("/AddTruckType")
    public int AddTruckType(@RequestBody PdTruckType pdTruckType){
        return iPdTruckTypeService.AddTruckType(pdTruckType);
    }

    @DeleteMapping("/DeleteTruckTypeById")
    public int DeleteTruckTypeById(@RequestParam int truckTypeId){
        return iPdTruckTypeService.DeleteTruckTypeById(truckTypeId);
    }

    @PutMapping("/UpdateTruckType")
    public int UpdateTruckType(@RequestBody PdTruckType pdTruckType){
        return iPdTruckTypeService.UpdateTruckType(pdTruckType);
    }

    @DeleteMapping("/DeleteGoodsTruck")
    public int DeleteGoodsTruck(@RequestParam int truckTypeId){
        return iPdTruckTypeService.DeleteGoodsTruck(truckTypeId);
    }

}
